<template>
  <el-tab-pane label="技术专家" name="技术专家">
    <el-form
      label-width="120px"
      label-position="left"
      ref="technologistFormRef"
      class="register-form"
    >
      <el-form-item label="账号">
        <el-input v-model="technologistForm.account" placeholder="请输入账号" />
      </el-form-item>
      <el-form-item label="手机号">
        <el-input v-model="technologistForm.phoneNumber" placeholder="请输入手机号" />
      </el-form-item>
      <el-form-item class="form-item-code" label="验证码">
        <el-input v-model="technologistForm.verificationCode" placeholder="请输入验证码" />
        <el-button @click="getVerificationCode">获取验证码</el-button>
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="technologistForm.password" placeholder="请输入密码" />
      </el-form-item>
      <el-form-item label="确认密码">
        <el-input v-model="technologistForm.confirmPassword" placeholder="请再次输入密码" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitTechnologistForm">注册</el-button>
      </el-form-item>
    </el-form>
  </el-tab-pane>
</template>

<script setup lang="ts">
import type { FormInstance } from 'element-plus';
import { ref } from 'vue';

const technologistFormRef = ref<FormInstance>();

// 技术专家表单
const technologistForm = ref({
  account: '',
  phoneNumber: '',
  verificationCode: '',
  password: '',
  confirmPassword: '',
});
// 提交技术专家表单
function submitTechnologistForm() {
  const form = technologistFormRef.value;
  form?.validate((valid: boolean) => {
    if (valid) {
      // 省略提交技术专家表单的逻辑
    } else {
      return false;
    }
  });
}
const emit = defineEmits(['getCode']);
function getVerificationCode() {
  emit('getCode');
}
</script>

<style lang="scss" scoped>
.form-item-code :deep(.el-form-item__content) {
  flex-wrap: nowrap;
}
</style>
